<%-- 
    Document   : SearchContest
    Created on : 3/04/2011, 06:39:46 PM
    Author     : Jhon
--%>

<%@page import="vo.VOContest"%>
<%@page import="java.util.List"%>
<%@page import="vo.VOUser"%>
<%@page import="control.Controller"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="HTML.*"%>
<%@include file="CheckSession.jsp"%>
<% String search = request.getParameter("search");
   String busqueda = request.getParameter("busqueda");
   if(search== null || search==""){
    response.sendRedirect("./BuscarContest.jsp");
    return;
   }


   Controller con = Controller.getInstance();


   VOContest p;
   if(busqueda.equals("1")){
    try{
     p = con.findContest(search);
    }catch(Exception e){
    response.sendRedirect("./BuscarContest.jsp");
   return;
   }
   if(p==null){
      response.sendRedirect("./BuscarContest.jsp");
   return;
   }

    session.setAttribute("CONTEST", p);
    response.sendRedirect("./ContestInfo.jsp");
    
   }else{
    try{
     p = con.findContest(search);
   }catch(Exception e){
   response.sendRedirect("./BuscarContest.jsp");
   return;
   }

    if(p==null){
      response.sendRedirect("./BuscarContest.jsp");
   return;
   }
    
    session.setAttribute("CONTEST", p);
    response.sendRedirect("./ContestInfo.jsp");
    

   }

    %>



